home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98b.txt / 000066_icon-group-sender _Thu Jun 4 12:30:25 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  6KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by baskerville.CS.Arizona.EDU (8.8.8/8.8.7) with SMTP id MAA06878
  4.     for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Thu, 4 Jun 1998 12:30:25 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA12324; Thu, 4 Jun 1998 12:30:18 -0700
  7. From: "Nevin :-] Liber" <nevin@pendragon-software.com>
  8. To: <icon-group@optima.CS.Arizona.EDU>
  9. Subject: Re: Directory access facilities
  10. Date: Thu, 4 Jun 1998 12:47:30 -0500
  11. Message-Id: <01bd8fe0$d860a2e0$c37546cf@NEVIN>
  12. Mime-Version: 1.0
  13. Content-Type: text/plain;
  14.     charset="iso-8859-1"
  15. Content-Transfer-Encoding: 7bit
  16. X-Priority: 3
  17. X-Msmail-Priority: Normal
  18. X-Mailer: Microsoft Outlook Express 4.71.1712.3
  19. X-Mimeole: Produced By Microsoft MimeOLE V4.71.1712.3
  20. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  21. Status: RO
  22. Content-Length: 5285
  23.  
  24. -----Original Message-----
  25. From: Richard A. O'Keefe <ok@atlas.otago.ac.nz>
  26. To: icon-group@optima.CS.Arizona.EDU <icon-group@optima.CS.Arizona.EDU>;
  27. nevin@pendragon-software.com <nevin@pendragon-software.com>
  28. Date: Thursday, June 04, 1998 10:11 AM
  29. Subject: Re: Directory access facilities
  30.  
  31.  
  32. Let me preface this by saying that I know very little about Tcl/Tk;
  33. basically, playing around with "tclsh" and checking out the man pages at
  34. <http://cuiwww.unige.ch/eao/www/TclTkMan/Man.html>.
  35.  
  36. >I'd like to say that people seem to have missed the point of my reference
  37. >to Tcl/Tk.  The point is that there is an *existing* *multiplatform*
  38. >implementation of this idea that *works*.  We don't have to design.
  39. >We can steal.
  40.  
  41. If it is the appropriate abstractions for the language at hand.  I don't
  42. believe it is.
  43.  
  44. >The *last* thing we have any shadow of an excuse for doing is bodging
  45. >together yet another incompatible design by appealing to "preferences".
  46.  
  47. My "preferences" come from using the language for the last 14 years, and I
  48. suspect that Gregg Townsend has been using it even longer than I have.  I
  49. think I have a pretty good sense of what fits in the language and what
  50. doesn't.
  51.  
  52. It appears that Tcl/Tk is a language where everything is a string.  For
  53. instance, "glob" returns a string of encoded filenames; one has to encode
  54. some the filenames, because they may contain embedded seperators, embedded
  55. encoding characters, etc.
  56.  
  57. In a shell this works, since a shell parses each and every command line, and
  58. provides facilities for dividing a delimiter-seperated string into seperate
  59. strings.
  60.  
  61. Icon does not do this, nor does it have builtin facilities for "unquoting"
  62. an encoded filename.  In order to use this, there would have to be a
  63. higher-level function that breaks up the string, gets rid of any quoting
  64. characters that aren't part of the filename, and either returns a list of,
  65. or more likely, generate a list of filenames.  Considering the lower level
  66. system already keeps filenames as seperate entities, it seems that we are
  67. doing a lot of work for nothing.
  68.  
  69. Now, one might argue that "glob" allows regular expressions for filtering.
  70. However, regular expressions aren't used anywhere else in Icon; it would
  71. look like a wart on the language.
  72.  
  73. What I am looking for is minimal functionality that will get me the
  74. filenames broken up one filename at a time, since it is easy to build the
  75. more complex stuff on top of that from within Icon.  Gregg's suggestion of a
  76. generator that does just that meets that criterion nicely.
  77.  
  78. >But where did you get the idea that the presence of "." and ".." was 'an
  79. >accurate representation of what is in the directory'?  There are POSIX
  80. >implementations that go to some trouble to fake these entries because the
  81. >_real_ directory format _doesn't_ have them.
  82.  
  83. And on "real" systems, "." and ".." don't necessarily do what you expect.
  84. For instance, most shells interpret them differently.  Do a "cd
  85. /foo/bar/../baz", and the shell would put you in "/foo/baz", yet if you
  86. actually traversed the directories, you could be in "/baz", if "/foo/bar"
  87. was a symbolic link to "/", for instance.  It's hard to encapsulate all of
  88. this functionality without providing a full filesystem API.
  89.  
  90. Whatever the lower-level C functions return is what the Icon equivalent
  91. should generate.
  92.  
  93.  
  94. >To the best of my knowledge there isn't any Icon implementation for that
  95. >machine, but there's a standard C compiler and a near-enough-to-POSIX
  96. >OS interface, so there _could_ be an Icon implementation.
  97.  
  98. I don't believe POSIX is a requirement of Icon right now.
  99.  
  100.  
  101. >As I've hinted above, we could
  102. >patch around this particular problem by insisting that directory names
  103. >always end with a (native) separator and file names not
  104.  
  105. But nothing else in Icon follows this convention.  Strings don't have
  106. special embedded terminators; lists don't have special embedded terminators,
  107. etc.  If you add a seperator or directory marker, you have to add a way of
  108. quoting the seperator or directory marker (since a file name might
  109. legitimately end with the directory marker) and functions to remove the
  110. quotes.  This is much messier than having a generator suspend filenames one
  111. at a time, and a seperate function to test if it is a directory.  Also, what
  112. if you are creating a directory name somewhere else in your program?  You
  113. have to have a function that turns a string into a directory name.
  114.  
  115. To use EE terms, I much prefer out-of-band signaling to in-band signaling.
  116. Since we can get filenames already seperated (out-of-band signaling, since
  117. something outside of the string itself indicates that this object represents
  118. a directory), it is cleaner than having to parse a string (in-band
  119. signaling, since whether or not it is a directory is encoded in the string)
  120. when I just want to get the filename out of it.
  121.  
  122. Now, I do understand your point about systems where directories are in
  123. seperate namespaces.  The cleanest solution would be to have two seperate
  124. generators; one which returns regular files, and one which returns
  125. directories.  I don't know if this is worth the effort, since so few systems
  126. out there have seperate namespaces.
  127. __
  128.  Nevin ":-)" Liber  <mailto:nevin@pendragon-software.com>  (847) 816-9926
  129.   Senior Software Engineer, Pendragon Software <http://www.webfayre.com/>
  130.  
  131.